------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\mgolder\Dropbox\campaign_sentiment_paper\replication\data_analysis\sentiment.log
  log type:  text
 opened on:  14 Jan 2019, 12:00:47

. #delimit ;
delimiter now ;
. *     ***************************************************************** *;
. *     ***************************************************************** *;
. *       File-Name:      sentiment.do                                    *;
. *       Date:           January 10, 2019                                *;
. *       Author:         MRG/CC                                          *;
. *       Purpose:        Data analysis replication file for It's Not     *;
. *                       Only What You Say, It's Also How You Say It:    *;
. *                       The Strategic Use Of Campaign Sentiment.        *;
. *                       Journal of Politics. Forthcoming                *;
. *           Input File:     sentiment.dta                                   *;
. *       Output File:    sentiment.log                                   *;
. *       Data Output:    none                                            *;
.              *       Previous file:  sentiment.dta                                   *;
. *       Machine:        desktop/laptop                                                  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *        Load data                                                      *;
. *     ****************************************************************  *;
. use "C:\Users\mgolder\Dropbox\campaign_sentiment_paper\replication\data_analysis\sentiment.dta", clear;

. set more off;

. *     ****************************************************************  *;
. *       Generate additional variables that are needed for our analysis. *;
. *     ****************************************************************  *;
. gen incumbent_inflation_l = incumbent*inflation_l;
(21 missing values generated)

. label var incumbent_inflation "incumbent*inflation_l";

. gen incumbent_unemployment_l = incumbent*unemployment_l;
(7 missing values generated)

. label var incumbent_unemployment_l "incumbent*unemployment_l";

. gen incumbent_lrgpde_growth = incumbent*lrgdpe_growth;

. label var incumbent_lrgpde_growth "incumbent*lrgpde_growth";

. gen incumbent_lrgpdo_growth = incumbent*lrgdpo_growth;

. label var incumbent_lrgpdo_growth "incumbent*lrgpdo_growth";

. gen incumbent_pm = incumbent*pm;

. label var incumbent_pm "incumbent*pm";

. gen incumbent_fm = incumbent*fm;

. label var incumbent_fm "incumbent*fm";

. gen left_right2=left_right*left_right;
(39 missing values generated)

. label var left_right2 "left_right*left_right";

. gen extremist = 0;

. replace extremist=1 if family_id ==14 | family_id==40;
(87 real changes made)

. replace extremist = . if family_id==.;
(9 real changes made, 9 to missing)

. label var extremist "1 if communist/socialist or far right, 0 otherwise";

. gen extremist2 = 0;

. replace extremist2=1 if family_id ==14 | family_id==40 | family_id==19;
(124 real changes made)

. replace extremist2 = . if family_id==.;
(9 real changes made, 9 to missing)

. label var extremist2 "1 if communist/socialist, far right, or greens, 0 otherwise";

. desc;

Contains data from C:\Users\mgolder\Dropbox\campaign_sentiment_paper\replication\data_analysis\sentiment.dta
  obs:           421                          
 vars:            34                          22 Apr 2017 15:16
 size:       168,821                          
------------------------------------------------------------------------------------------------------------------------------------------------
              storage   display    value
variable name   type    format     label      variable label
------------------------------------------------------------------------------------------------------------------------------------------------
cow             float   %8.0g                 cow country code
country         str34   %34s                  country name
year            int     %8.0g                 year
election_id     long    %8.0g      election_id
                                              election-specific id
party_name_en~h str120  %120s                 party name in English
family_name     str19   %19s                  party family name (parlgov)
family_id       byte    %8.0g                 party family id (parlgov)
language        long    %10.0g     language   language
positive_sent~t float   %8.0g                 positive emotion minus negative emotion (liwc)
positive_emot~n float   %8.0g                 percent positive words in manifesto (liwc)
negative_emot~n float   %8.0g                 percent negative words in manifesto (liwc)
incumbent       byte    %8.0g                 1 if in government, 0 otherwise (Glasgow Golder 2015
pm              byte    %8.0g                 1 if prime ministerial party, 0 otherwise (Glasgow Golder 2015)
fm              byte    %8.0g                 1 if finance ministerial party, 0 otherwise (parlgov)
left_right      float   %8.0g                 0-10 left-right scale, expert surveys (parlgov)
inflation       float   %8.0g                 inflation rate (WDI 2012, World Bank)
inflation_l     float   %8.0g                 inflation rate lagged one year (WDI 2012, World Bank)
unemployment    float   %8.0g                 unemployment rate (IMF 2015)
unemployment_l  float   %8.0g                 unemployment rate lagged one year (IMF 2015)
rgdpe_growth    float   %9.0g                 growth in real gdp in expenditures (millions of 2011 US dollars)
lrgdpe_growth   float   %9.0g                  lagged growth in real gdp expenditures (millions of 2011 US dollars)
rgdpo_growth    float   %9.0g                 growth in real gdp in output (millions of 2011 US dollars)
lrgdpo_growth   float   %9.0g                 lagged growth in real gdp output (millions of 2011 US dollars)
party_id        int     %8.0g                 party id (parlgov)
party_name      str124  %124s                 party name in native language
incumbent_inf~l float   %9.0g                 incumbent*inflation_l
incumbent_une~l float   %9.0g                 incumbent*unemployment_l
incumb~e_growth float   %9.0g                 incumbent*lrgpde_growth
incumb~o_growth float   %9.0g                 incumbent*lrgpdo_growth
incumbent_pm    float   %9.0g                 incumbent*pm
incumbent_fm    float   %9.0g                 incumbent*fm
left_right2     float   %9.0g                 left_right*left_right
extremist       float   %9.0g                 1 if communist/socialist or far right, 0 otherwise
extremist2      float   %9.0g                 1 if communist/socialist, far right, or greens, 0 otherwise
------------------------------------------------------------------------------------------------------------------------------------------------
Sorted by: country  year  election_id
     Note: Dataset has changed since last saved.

. sum;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
         cow |        421    234.2874    38.36343        200        325
     country |          0
        year |        421    1996.347    9.457847       1980       2012
 election_id |        421    33.21615    21.18554          1         70
party_name~h |          0
-------------+---------------------------------------------------------
 family_name |          0
   family_id |        412    14.24515    9.051924          3         40
    language |        421    3.491686    2.110755          1          7
positive_s~t |        421    1.696912    1.446166       -.68        7.6
positive_e~n |        421     3.02133    1.908511        .64       9.62
-------------+---------------------------------------------------------
negative_e~n |        421    1.324418    .7893864          0       5.22
   incumbent |        421    .2541568    .4359042          0          1
          pm |        421    .1543943    .3617562          0          1
          fm |        421    .1496437    .3571463          0          1
  left_right |        382     4.98458    2.366081         .5   9.824561
-------------+---------------------------------------------------------
   inflation |        400    4.367223    4.699949    -.83553   25.10564
 inflation_l |        400    4.911179    5.451015  -.9461664   28.78333
unemployment |        421    8.899962    4.497289      3.359      22.64
unemployme~l |        414    8.747821    4.522593      3.137       22.9
rgdpe_growth |        421    2.852763    3.571232  -4.305958   12.30451
-------------+---------------------------------------------------------
lrgdpe_gro~h |        421    2.716662    3.391096  -6.225039   10.43808
rgdpo_growth |        421    2.955977    3.621164  -6.712398   12.85193
lrgdpo_gro~h |        421    2.572339    3.704223  -7.322986   10.34733
    party_id |        421    797.2565    465.0217         11       1647
  party_name |          0
-------------+---------------------------------------------------------
incumben~n_l |        400    1.359408    3.844508  -.9461664   28.78333
incumben~t_l |        414    2.160932    4.305807          0       22.9
inc~e_growth |        421    .6976881     2.05097  -6.225039   10.43808
inc~o_growth |        421    .6570862    2.107362  -7.322986   10.34733
incumbent_pm |        421    .1543943    .3617562          0          1
-------------+---------------------------------------------------------
incumbent_fm |        421    .1377672    .3450656          0          1
 left_right2 |        382    30.42972    24.22462        .25     96.522
   extremist |        412     .211165    .4086314          0          1
  extremist2 |        412    .3009709    .4592377          0          1

. *     ****************************************************************  *;
. *       Mean positive and negative word scores across all manifestos.   *;
. *       This is reported in Table 1.                                    *;
. *     ****************************************************************  *;
. sum  positive_emotion;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
positive_e~n |        421     3.02133    1.908511        .64       9.62

. sum  negative_emotion;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
negative_e~n |        421    1.324418    .7893864          0       5.22

. *     ****************************************************************  *;
. *       Mean positive and negative word scores in English language      *;
. *       manifestos.                                                     *;
. *     ****************************************************************  *;
. sum  positive_emotion if language==2;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
positive_e~n |         85    3.763765    .5851597       2.21       5.34

. sum  negative_emotion if language==2;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
negative_e~n |         85    1.390118    .3773072        .71       3.09

. *     ****************************************************************  *;
. *       Declare data to be panel, where the panel is based on language  *;
. *     ****************************************************************  *;
. xtset language;
       panel variable:  language (unbalanced)

. xtsum positive_sentiment;

Variable         |      Mean   Std. Dev.       Min        Max |    Observations
-----------------+--------------------------------------------+----------------
positi~t overall |  1.696912   1.446166       -.68        7.6 |     N =     421
         between |              1.34797   .4018627     4.3828 |     n =       7
         within  |             .7198334  -1.565888   4.914112 | T-bar = 60.1429

. *     ****************************************************************  *;
. *       Results in Table 2 - Constant is the average language fixed     *;
. *       effect.                                                         *;
. *     ****************************************************************  *;
. * Model 1 *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       421
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.1008                         Obs per group: min =        36
       between = 0.0007                                        avg =      60.1
       overall = 0.0266                                        max =       102

                                                Wald chi2(1)       =     57.57
corr(u_i, Xb)  = 0.0046                         Prob > chi2        =    0.0000

                            (Replications based on 70 clusters in election_id)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
positive_s~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   incumbent |   .5280646   .0695955     7.59   0.000     .3916599    .6644694
       _cons |   1.562701   .1501875    10.41   0.000     1.268339    1.857063
-------------+----------------------------------------------------------------
     sigma_u |  1.3474834
     sigma_e |  .68835933
         rho |  .79304294   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. * Model 2 *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent incumbent_pm, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       421
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.1097                         Obs per group: min =        36
       between = 0.0803                                        avg =      60.1
       overall = 0.0390                                        max =       102

                                                Wald chi2(2)       =     61.10
corr(u_i, Xb)  = 0.0370                         Prob > chi2        =    0.0000

                            (Replications based on 70 clusters in election_id)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
positive_s~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   incumbent |    .356483   .0750253     4.75   0.000     .2094362    .5035298
incumbent_pm |   .2800309   .0749149     3.74   0.000     .1332004    .4268614
       _cons |   1.563074   .1502883    10.40   0.000     1.268515    1.857634
-------------+----------------------------------------------------------------
     sigma_u |    1.34004
     sigma_e |  .68576863
         rho |  .79246181   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. * Model 3 *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent incumbent_pm left_right left_right2, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       382
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.1817                         Obs per group: min =        35
       between = 0.0954                                        avg =      54.6
       overall = 0.0675                                        max =        90

                                                Wald chi2(4)       =     91.61
corr(u_i, Xb)  = 0.0652                         Prob > chi2        =    0.0000

                            (Replications based on 69 clusters in election_id)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
positive_s~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   incumbent |   .1545325   .0637387     2.42   0.015     .0296071     .279458
incumbent_pm |    .239634   .0733366     3.27   0.001     .0958969    .3833711
  left_right |   .4104397   .0690804     5.94   0.000     .2750446    .5458347
 left_right2 |  -.0376656   .0069866    -5.39   0.000    -.0513591   -.0239722
       _cons |   .7746918   .1390328     5.57   0.000     .5021925    1.047191
-------------+----------------------------------------------------------------
     sigma_u |  1.3907853
     sigma_e |  .62788657
         rho |  .83069045   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. * Model 4 *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent incumbent_pm extremist, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       412
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.1834                         Obs per group: min =        35
       between = 0.1569                                        avg =      58.9
       overall = 0.0325                                        max =       100

                                                Wald chi2(3)       =     71.65
corr(u_i, Xb)  = -0.0408                        Prob > chi2        =    0.0000

                            (Replications based on 70 clusters in election_id)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
positive_s~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   incumbent |   .2555482   .0776734     3.29   0.001     .1033112    .4077852
incumbent_pm |   .2428077   .0770869     3.15   0.002     .0917202    .3938951
   extremist |  -.5040679   .1044126    -4.83   0.000    -.7087128    -.299423
       _cons |   1.719485   .1639879    10.49   0.000     1.398074    2.040895
-------------+----------------------------------------------------------------
     sigma_u |  1.3615153
     sigma_e |  .66276504
         rho |   .8084339   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. * Model 5 *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent incumbent_pm extremist inflation_l, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       391
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.2057                         Obs per group: min =        31
       between = 0.4541                                        avg =      55.9
       overall = 0.0012                                        max =       100

                                                Wald chi2(4)       =     86.82
corr(u_i, Xb)  = -0.2179                        Prob > chi2        =    0.0000

                            (Replications based on 64 clusters in election_id)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
positive_s~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   incumbent |   .2650156   .0774347     3.42   0.001     .1132463    .4167848
incumbent_pm |   .2062344   .0805601     2.56   0.010     .0483395    .3641293
   extremist |  -.4949045   .1079482    -4.58   0.000    -.7064791   -.2833299
 inflation_l |  -.0281764   .0131224    -2.15   0.032    -.0538959   -.0024569
       _cons |   1.847508   .1952742     9.46   0.000     1.464777    2.230238
-------------+----------------------------------------------------------------
     sigma_u |  1.4253002
     sigma_e |  .65502756
         rho |  .82562331   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. * Model 6 *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent incumbent_pm extremist unemployment_l, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       405
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.1890                         Obs per group: min =        35
       between = 0.0197                                        avg =      57.9
       overall = 0.0170                                        max =       100

                                                Wald chi2(4)       =     85.15
corr(u_i, Xb)  = -0.0975                        Prob > chi2        =    0.0000

                              (Replications based on 68 clusters in election_id)
--------------------------------------------------------------------------------
               |   Observed   Bootstrap                         Normal-based
positive_sen~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
     incumbent |   .2443843    .073679     3.32   0.001     .0999761    .3887925
  incumbent_pm |   .2395275   .0797955     3.00   0.003     .0831313    .3959238
     extremist |  -.4540733    .112523    -4.04   0.000    -.6746144   -.2335322
unemployment_l |   -.027279   .0109923    -2.48   0.013    -.0488236   -.0057344
         _cons |   1.944063   .2038082     9.54   0.000     1.544607     2.34352
---------------+----------------------------------------------------------------
       sigma_u |   1.398648
       sigma_e |  .63723563
           rho |  .82810323   (fraction of variance due to u_i)
--------------------------------------------------------------------------------

. * Model 7 *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent incumbent_pm extremist lrgdpe_growth, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       412
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.1835                         Obs per group: min =        35
       between = 0.1683                                        avg =      58.9
       overall = 0.0319                                        max =       100

                                                Wald chi2(4)       =     72.50
corr(u_i, Xb)  = -0.0428                        Prob > chi2        =    0.0000

                             (Replications based on 70 clusters in election_id)
-------------------------------------------------------------------------------
              |   Observed   Bootstrap                         Normal-based
positive_se~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
    incumbent |   .2557025   .0779149     3.28   0.001     .1029922    .4084129
 incumbent_pm |   .2426094    .077017     3.15   0.002     .0916589      .39356
    extremist |  -.5041256   .1043136    -4.83   0.000    -.7085764   -.2996748
lrgdpe_growth |  -.0014959   .0105937    -0.14   0.888    -.0222592    .0192675
        _cons |   1.723572   .1652309    10.43   0.000     1.399725    2.047418
--------------+----------------------------------------------------------------
      sigma_u |   1.362111
      sigma_e |  .66357166
          rho |  .80819254   (fraction of variance due to u_i)
-------------------------------------------------------------------------------

. * Model 8 *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent incumbent_pm extremist inflation_l incumbent_inflati
> on_l, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       391
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.2228                         Obs per group: min =        31
       between = 0.4746                                        avg =      55.9
       overall = 0.0015                                        max =       100

                                                Wald chi2(5)       =    107.72
corr(u_i, Xb)  = -0.2237                        Prob > chi2        =    0.0000

                                     (Replications based on 64 clusters in election_id)
---------------------------------------------------------------------------------------
                      |   Observed   Bootstrap                         Normal-based
   positive_sentiment |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
            incumbent |   .0522727   .1128164     0.46   0.643    -.1688433    .2733888
         incumbent_pm |   .2331414   .0804999     2.90   0.004     .0753646    .3909183
            extremist |  -.4713886   .1036157    -4.55   0.000    -.6744716   -.2683056
          inflation_l |  -.0404941    .014497    -2.79   0.005    -.0689076   -.0120806
incumbent_inflation_l |   .0379998   .0158698     2.39   0.017     .0068956    .0691041
                _cons |   1.899274   .2017465     9.41   0.000     1.503858     2.29469
----------------------+----------------------------------------------------------------
              sigma_u |  1.4322672
              sigma_e |  .64877972
                  rho |  .82974785   (fraction of variance due to u_i)
---------------------------------------------------------------------------------------

. * Model 9 *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent incumbent_pm extremist unemployment_l incumbent_unem
> ployment_l, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       405
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.1902                         Obs per group: min =        35
       between = 0.0223                                        avg =      57.9
       overall = 0.0172                                        max =       100

                                                Wald chi2(5)       =     94.22
corr(u_i, Xb)  = -0.0970                        Prob > chi2        =    0.0000

                                        (Replications based on 68 clusters in election_id)
------------------------------------------------------------------------------------------
                         |   Observed   Bootstrap                         Normal-based
      positive_sentiment |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------------------+----------------------------------------------------------------
               incumbent |   .3445268   .1381043     2.49   0.013     .0738472    .6152063
            incumbent_pm |   .2563192    .080232     3.19   0.001     .0990673     .413571
               extremist |  -.4538443   .1124822    -4.03   0.000    -.6743054   -.2333832
          unemployment_l |  -.0240029   .0121882    -1.97   0.049    -.0478914   -.0001144
incumbent_unemployment_l |  -.0128492   .0166773    -0.77   0.441    -.0455361    .0198378
                   _cons |   1.915028   .2030541     9.43   0.000     1.517049    2.313006
-------------------------+----------------------------------------------------------------
                 sigma_u |  1.3988999
                 sigma_e |  .63756734
                     rho |  .82800631   (fraction of variance due to u_i)
------------------------------------------------------------------------------------------

. * Model 10 *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent incumbent_pm extremist lrgdpe_growth incumbent_lrgpd
> e_growth, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       412
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.1838                         Obs per group: min =        35
       between = 0.1689                                        avg =      58.9
       overall = 0.0317                                        max =       100

                                                Wald chi2(5)       =     85.78
corr(u_i, Xb)  = -0.0438                        Prob > chi2        =    0.0000

                                       (Replications based on 70 clusters in election_id)
-----------------------------------------------------------------------------------------
                        |   Observed   Bootstrap                         Normal-based
     positive_sentiment |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
------------------------+----------------------------------------------------------------
              incumbent |   .2306242   .0957496     2.41   0.016     .0429585    .4182899
           incumbent_pm |   .2422159   .0782696     3.09   0.002     .0888103    .3956214
              extremist |  -.5055037   .1031806    -4.90   0.000    -.7077339   -.3032735
          lrgdpe_growth |  -.0037399   .0113967    -0.33   0.743    -.0260769    .0185972
incumbent_lrgpde_growth |   .0091339    .018501     0.49   0.622    -.0271273    .0453951
                  _cons |   1.730052    .162896    10.62   0.000     1.410782    2.049322
------------------------+----------------------------------------------------------------
                sigma_u |  1.3624803
                sigma_e |  .66426329
                    rho |  .80795349   (fraction of variance due to u_i)
-----------------------------------------------------------------------------------------

. * Model 11 *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent incumbent_pm extremist inflation_l incumbent_inflati
> on_l unemployment_l incumbent_unemployment_l lrgdpe_growth incumbent_lrgpde_growth, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       388
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.2173                         Obs per group: min =        31
       between = 0.3241                                        avg =      55.4
       overall = 0.0000                                        max =       100

                                                Wald chi2(9)       =    131.54
corr(u_i, Xb)  = -0.2516                        Prob > chi2        =    0.0000

                                        (Replications based on 63 clusters in election_id)
------------------------------------------------------------------------------------------
                         |   Observed   Bootstrap                         Normal-based
      positive_sentiment |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------------------+----------------------------------------------------------------
               incumbent |   .1365095   .1569805     0.87   0.385    -.1711666    .4441855
            incumbent_pm |   .2422422   .0850165     2.85   0.004     .0756129    .4088715
               extremist |  -.4310096   .1001545    -4.30   0.000    -.6273089   -.2347103
             inflation_l |  -.0354643   .0142861    -2.48   0.013    -.0634646   -.0074641
   incumbent_inflation_l |   .0314988   .0175654     1.79   0.073    -.0029287    .0659263
          unemployment_l |  -.0256988   .0128736    -2.00   0.046    -.0509306    -.000467
incumbent_unemployment_l |    -.01094   .0162741    -0.67   0.501    -.0428366    .0209566
           lrgdpe_growth |  -.0183259   .0112484    -1.63   0.103    -.0403724    .0037206
 incumbent_lrgpde_growth |   .0128794   .0182312     0.71   0.480    -.0228532     .048612
                   _cons |   2.128383   .2121478    10.03   0.000     1.712581    2.544185
-------------------------+----------------------------------------------------------------
                 sigma_u |  1.4586986
                 sigma_e |  .63012564
                     rho |  .84274045   (fraction of variance due to u_i)
------------------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Substantive results on incumbency status via simulation         *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       incumbent vs opposition - Model 1                               *;
. *     ****************************************************************  *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       421
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.1008                         Obs per group: min =        36
       between = 0.0007                                        avg =      60.1
       overall = 0.0266                                        max =       102

                                                Wald chi2(1)       =     57.57
corr(u_i, Xb)  = 0.0046                         Prob > chi2        =    0.0000

                            (Replications based on 70 clusters in election_id)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
positive_s~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   incumbent |   .5280646   .0695955     7.59   0.000     .3916599    .6644694
       _cons |   1.562701   .1501875    10.41   0.000     1.268339    1.857063
-------------+----------------------------------------------------------------
     sigma_u |  1.3474834
     sigma_e |  .68835933
         rho |  .79304294   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. preserve;

. set obs 10000;
number of observations (_N) was 421, now 10,000

. set seed 10101;

. drawnorm MG_b1-MG_b2, n(100000) means(e(b)) cov(e(V)) clear;
(obs 100,000)

. save simulated_betas, replace;
file simulated_betas.dta saved

. restore;

. merge using simulated_betas;
(note: you are using old merge syntax; see [D] merge for new syntax)

. summarize;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
         cow |        421    234.2874    38.36343        200        325
     country |          0
        year |        421    1996.347    9.457847       1980       2012
 election_id |        421    33.21615    21.18554          1         70
party_name~h |          0
-------------+---------------------------------------------------------
 family_name |          0
   family_id |        412    14.24515    9.051924          3         40
    language |        421    3.491686    2.110755          1          7
positive_s~t |        421    1.696912    1.446166       -.68        7.6
positive_e~n |        421     3.02133    1.908511        .64       9.62
-------------+---------------------------------------------------------
negative_e~n |        421    1.324418    .7893864          0       5.22
   incumbent |        421    .2541568    .4359042          0          1
          pm |        421    .1543943    .3617562          0          1
          fm |        421    .1496437    .3571463          0          1
  left_right |        382     4.98458    2.366081         .5   9.824561
-------------+---------------------------------------------------------
   inflation |        400    4.367223    4.699949    -.83553   25.10564
 inflation_l |        400    4.911179    5.451015  -.9461664   28.78333
unemployment |        421    8.899962    4.497289      3.359      22.64
unemployme~l |        414    8.747821    4.522593      3.137       22.9
rgdpe_growth |        421    2.852763    3.571232  -4.305958   12.30451
-------------+---------------------------------------------------------
lrgdpe_gro~h |        421    2.716662    3.391096  -6.225039   10.43808
rgdpo_growth |        421    2.955977    3.621164  -6.712398   12.85193
lrgdpo_gro~h |        421    2.572339    3.704223  -7.322986   10.34733
    party_id |        421    797.2565    465.0217         11       1647
  party_name |          0
-------------+---------------------------------------------------------
incumben~n_l |        400    1.359408    3.844508  -.9461664   28.78333
incumben~t_l |        414    2.160932    4.305807          0       22.9
inc~e_growth |        421    .6976881     2.05097  -6.225039   10.43808
inc~o_growth |        421    .6570862    2.107362  -7.322986   10.34733
incumbent_pm |        421    .1543943    .3617562          0          1
-------------+---------------------------------------------------------
incumbent_fm |        421    .1377672    .3450656          0          1
 left_right2 |        382    30.42972    24.22462        .25     96.522
   extremist |        412     .211165    .4086314          0          1
  extremist2 |        412    .3009709    .4592377          0          1
       MG_b1 |    100,000    .5277361    .0695358   .2122811   .8547007
-------------+---------------------------------------------------------
       MG_b2 |    100,000    1.563509      .15084   .8947924    2.19087
      _merge |    100,000     2.00421    .0647481          2          3

. gen incumbent1 = (MG_b2+MG_b1)/(MG_b2);

. sum incumbent1;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
  incumbent1 |    100,000        1.34    .0514014   1.146772   1.647635

. centile incumbent1, centile(2.5 97.5);

                                                       -- Binom. Interp. --
    Variable |       Obs  Percentile    Centile        [95% Conf. Interval]
-------------+-------------------------------------------------------------
  incumbent1 |   100,000        2.5    1.245632        1.244882    1.246263
             |                 97.5      1.4488        1.447918    1.449821

. drop MG_b1-MG_b2 incumbent1 _merge;

. *     ****************************************************************  *;
. *       non-PM incumbent vs opposition - Model 2                        *;
. *     ****************************************************************  *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent incumbent_pm, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       421
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.1097                         Obs per group: min =        36
       between = 0.0803                                        avg =      60.1
       overall = 0.0390                                        max =       102

                                                Wald chi2(2)       =     61.10
corr(u_i, Xb)  = 0.0370                         Prob > chi2        =    0.0000

                            (Replications based on 70 clusters in election_id)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
positive_s~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   incumbent |    .356483   .0750253     4.75   0.000     .2094362    .5035298
incumbent_pm |   .2800309   .0749149     3.74   0.000     .1332004    .4268614
       _cons |   1.563074   .1502883    10.40   0.000     1.268515    1.857634
-------------+----------------------------------------------------------------
     sigma_u |    1.34004
     sigma_e |  .68576863
         rho |  .79246181   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. preserve;

. set obs 100000;
number of observations (_N) was 100,000, now 100,000

. set seed 10101;

. drawnorm MG_b1-MG_b3, n(100000) means(e(b)) cov(e(V)) clear;
(obs 100,000)

. save simulated_betas, replace;
file simulated_betas.dta saved

. restore;

. merge using simulated_betas;
(note: you are using old merge syntax; see [D] merge for new syntax)

. summarize;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
         cow |        421    234.2874    38.36343        200        325
     country |          0
        year |        421    1996.347    9.457847       1980       2012
 election_id |        421    33.21615    21.18554          1         70
party_name~h |          0
-------------+---------------------------------------------------------
 family_name |          0
   family_id |        412    14.24515    9.051924          3         40
    language |        421    3.491686    2.110755          1          7
positive_s~t |        421    1.696912    1.446166       -.68        7.6
positive_e~n |        421     3.02133    1.908511        .64       9.62
-------------+---------------------------------------------------------
negative_e~n |        421    1.324418    .7893864          0       5.22
   incumbent |        421    .2541568    .4359042          0          1
          pm |        421    .1543943    .3617562          0          1
          fm |        421    .1496437    .3571463          0          1
  left_right |        382     4.98458    2.366081         .5   9.824561
-------------+---------------------------------------------------------
   inflation |        400    4.367223    4.699949    -.83553   25.10564
 inflation_l |        400    4.911179    5.451015  -.9461664   28.78333
unemployment |        421    8.899962    4.497289      3.359      22.64
unemployme~l |        414    8.747821    4.522593      3.137       22.9
rgdpe_growth |        421    2.852763    3.571232  -4.305958   12.30451
-------------+---------------------------------------------------------
lrgdpe_gro~h |        421    2.716662    3.391096  -6.225039   10.43808
rgdpo_growth |        421    2.955977    3.621164  -6.712398   12.85193
lrgdpo_gro~h |        421    2.572339    3.704223  -7.322986   10.34733
    party_id |        421    797.2565    465.0217         11       1647
  party_name |          0
-------------+---------------------------------------------------------
incumben~n_l |        400    1.359408    3.844508  -.9461664   28.78333
incumben~t_l |        414    2.160932    4.305807          0       22.9
inc~e_growth |        421    .6976881     2.05097  -6.225039   10.43808
inc~o_growth |        421    .6570862    2.107362  -7.322986   10.34733
incumbent_pm |        421    .1543943    .3617562          0          1
-------------+---------------------------------------------------------
incumbent_fm |        421    .1377672    .3450656          0          1
 left_right2 |        382    30.42972    24.22462        .25     96.522
   extremist |        412     .211165    .4086314          0          1
  extremist2 |        412    .3009709    .4592377          0          1
       MG_b1 |    100,000    .3561289    .0749608   .0160626   .7086026
-------------+---------------------------------------------------------
       MG_b2 |    100,000    .2806055    .0751266   -.047839   .5967448
       MG_b3 |    100,000    1.562287    .1505724   .8789625   2.222767
      _merge |    100,000           3           0          3          3

. gen non_PM = (MG_b3+MG_b1)/(MG_b3);

. sum non_PM;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
      non_PM |    100,000    1.230341    .0546675   1.011712   1.540755

. centile non_PM, centile(2.5 97.5);

                                                       -- Binom. Interp. --
    Variable |       Obs  Percentile    Centile        [95% Conf. Interval]
-------------+-------------------------------------------------------------
      non_PM |   100,000        2.5    1.129209        1.128386    1.129942
             |                 97.5    1.344751        1.343768    1.345738

. *     ****************************************************************  *;
. *       PM incumbent vs opposition - Model 2                            *;
. *     ****************************************************************  *;
. gen PM = (MG_b3+MG_b1+MG_b2)/(MG_b3);

. sum PM;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
          PM |    100,000    1.410505    .0607156    1.17262   1.728163

. centile PM, centile(2.5 97.5);

                                                       -- Binom. Interp. --
    Variable |       Obs  Percentile    Centile        [95% Conf. Interval]
-------------+-------------------------------------------------------------
          PM |   100,000        2.5    1.299518        1.298679    1.300369
             |                 97.5    1.538158        1.536961    1.539581

. *     ****************************************************************  *;
. *       PM incumbent vs non_PM incumbent - Model 2                      *;
. *     ****************************************************************  *;
. gen incumbent_difference = PM-non_PM;

. sum incumbent_difference;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
incumbent_~e |    100,000    .1801644    .0476752  -.0326457   .4490958

. centile incumbent_difference, centile(2.5 97.5);

                                                       -- Binom. Interp. --
    Variable |       Obs  Percentile    Centile        [95% Conf. Interval]
-------------+-------------------------------------------------------------
incumbent_~e |   100,000        2.5    .0883381        .0875557    .0891991
             |                 97.5    .2754364        .2744859    .2765321

. drop MG_b1-MG_b3 PM non_PM incumbent_difference _merge;

. *     ****************************************************************  *;
. *     ****************************************************************  *;
. *       Substantive results on policy position via simulation           *;
. *       Model 3                                                         *;
. *     ****************************************************************  *;
. *     ****************************************************************  *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent incumbent_pm left_right left_right2, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       382
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.1817                         Obs per group: min =        35
       between = 0.0954                                        avg =      54.6
       overall = 0.0675                                        max =        90

                                                Wald chi2(4)       =     91.61
corr(u_i, Xb)  = 0.0652                         Prob > chi2        =    0.0000

                            (Replications based on 69 clusters in election_id)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
positive_s~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   incumbent |   .1545325   .0637387     2.42   0.015     .0296071     .279458
incumbent_pm |    .239634   .0733366     3.27   0.001     .0958969    .3833711
  left_right |   .4104397   .0690804     5.94   0.000     .2750446    .5458347
 left_right2 |  -.0376656   .0069866    -5.39   0.000    -.0513591   -.0239722
       _cons |   .7746918   .1390328     5.57   0.000     .5021925    1.047191
-------------+----------------------------------------------------------------
     sigma_u |  1.3907853
     sigma_e |  .62788657
         rho |  .83069045   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *       At what level of left-right is positive sentiment maximized?    *;
. *       Set marginal effect of left-right equal to 0 and solve.         *;
. *     ****************************************************************  *;
. di _b[left_right]/(-2*_b[left_right2]);
5.4484643

. *     ****************************************************************  *;
. *       extremist opposition vs moderate opposition - Model 4           *;
. *     ****************************************************************  *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent incumbent_pm extremist, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       412
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.1834                         Obs per group: min =        35
       between = 0.1569                                        avg =      58.9
       overall = 0.0325                                        max =       100

                                                Wald chi2(3)       =     71.65
corr(u_i, Xb)  = -0.0408                        Prob > chi2        =    0.0000

                            (Replications based on 70 clusters in election_id)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
positive_s~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   incumbent |   .2555482   .0776734     3.29   0.001     .1033112    .4077852
incumbent_pm |   .2428077   .0770869     3.15   0.002     .0917202    .3938951
   extremist |  -.5040679   .1044126    -4.83   0.000    -.7087128    -.299423
       _cons |   1.719485   .1639879    10.49   0.000     1.398074    2.040895
-------------+----------------------------------------------------------------
     sigma_u |  1.3615153
     sigma_e |  .66276504
         rho |   .8084339   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. preserve;

. set obs 100000;
number of observations (_N) was 100,000, now 100,000

. set seed 10101;

. drawnorm MG_b1-MG_b4, n(100000) means(e(b)) cov(e(V)) clear;
(obs 100,000)

. save simulated_betas, replace;
file simulated_betas.dta saved

. restore;

. merge using simulated_betas;
(note: you are using old merge syntax; see [D] merge for new syntax)

. summarize;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
         cow |        421    234.2874    38.36343        200        325
     country |          0
        year |        421    1996.347    9.457847       1980       2012
 election_id |        421    33.21615    21.18554          1         70
party_name~h |          0
-------------+---------------------------------------------------------
 family_name |          0
   family_id |        412    14.24515    9.051924          3         40
    language |        421    3.491686    2.110755          1          7
positive_s~t |        421    1.696912    1.446166       -.68        7.6
positive_e~n |        421     3.02133    1.908511        .64       9.62
-------------+---------------------------------------------------------
negative_e~n |        421    1.324418    .7893864          0       5.22
   incumbent |        421    .2541568    .4359042          0          1
          pm |        421    .1543943    .3617562          0          1
          fm |        421    .1496437    .3571463          0          1
  left_right |        382     4.98458    2.366081         .5   9.824561
-------------+---------------------------------------------------------
   inflation |        400    4.367223    4.699949    -.83553   25.10564
 inflation_l |        400    4.911179    5.451015  -.9461664   28.78333
unemployment |        421    8.899962    4.497289      3.359      22.64
unemployme~l |        414    8.747821    4.522593      3.137       22.9
rgdpe_growth |        421    2.852763    3.571232  -4.305958   12.30451
-------------+---------------------------------------------------------
lrgdpe_gro~h |        421    2.716662    3.391096  -6.225039   10.43808
rgdpo_growth |        421    2.955977    3.621164  -6.712398   12.85193
lrgdpo_gro~h |        421    2.572339    3.704223  -7.322986   10.34733
    party_id |        421    797.2565    465.0217         11       1647
  party_name |          0
-------------+---------------------------------------------------------
incumben~n_l |        400    1.359408    3.844508  -.9461664   28.78333
incumben~t_l |        414    2.160932    4.305807          0       22.9
inc~e_growth |        421    .6976881     2.05097  -6.225039   10.43808
inc~o_growth |        421    .6570862    2.107362  -7.322986   10.34733
incumbent_pm |        421    .1543943    .3617562          0          1
-------------+---------------------------------------------------------
incumbent_fm |        421    .1377672    .3450656          0          1
 left_right2 |        382    30.42972    24.22462        .25     96.522
   extremist |        412     .211165    .4086314          0          1
  extremist2 |        412    .3009709    .4592377          0          1
       MG_b1 |    100,000    .2551816    .0776067  -.0968878   .6200964
-------------+---------------------------------------------------------
       MG_b2 |    100,000    .2434079    .0772737  -.0982193   .5716601
       MG_b3 |    100,000   -.5048136    .1046974  -.9708226  -.0542372
       MG_b4 |    100,000    1.720395    .1635842   1.043124   2.387211
      _merge |    100,000           3           0          3          3

. gen extremist_opposition = (MG_b4+MG_b3)/(MG_b4);

. sum extremist_opposition;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
extremist_~n |    100,000    .7066308      .05452   .4659809   .9695353

. centile extremist_opposition, centile(2.5 97.5);

                                                       -- Binom. Interp. --
    Variable |       Obs  Percentile    Centile        [95% Conf. Interval]
-------------+-------------------------------------------------------------
extremist_~n |   100,000        2.5    .5996192        .5987542    .6006125
             |                 97.5     .814083        .8132398    .8150484

. drop MG_b1-MG_b4 extremist_opposition _merge;

. *     ****************************************************************  *;
. *       extremist non-PM incumbent vs moderate non-PM incumbent         *;
. *     ****************************************************************  *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent incumbent_pm extremist, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       412
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.1834                         Obs per group: min =        35
       between = 0.1569                                        avg =      58.9
       overall = 0.0325                                        max =       100

                                                Wald chi2(3)       =     71.65
corr(u_i, Xb)  = -0.0408                        Prob > chi2        =    0.0000

                            (Replications based on 70 clusters in election_id)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
positive_s~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   incumbent |   .2555482   .0776734     3.29   0.001     .1033112    .4077852
incumbent_pm |   .2428077   .0770869     3.15   0.002     .0917202    .3938951
   extremist |  -.5040679   .1044126    -4.83   0.000    -.7087128    -.299423
       _cons |   1.719485   .1639879    10.49   0.000     1.398074    2.040895
-------------+----------------------------------------------------------------
     sigma_u |  1.3615153
     sigma_e |  .66276504
         rho |   .8084339   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. preserve;

. set obs 100000;
number of observations (_N) was 100,000, now 100,000

. set seed 10101;

. drawnorm MG_b1-MG_b4, n(100000) means(e(b)) cov(e(V)) clear;
(obs 100,000)

. save simulated_betas, replace;
file simulated_betas.dta saved

. restore;

. merge using simulated_betas;
(note: you are using old merge syntax; see [D] merge for new syntax)

. summarize;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
         cow |        421    234.2874    38.36343        200        325
     country |          0
        year |        421    1996.347    9.457847       1980       2012
 election_id |        421    33.21615    21.18554          1         70
party_name~h |          0
-------------+---------------------------------------------------------
 family_name |          0
   family_id |        412    14.24515    9.051924          3         40
    language |        421    3.491686    2.110755          1          7
positive_s~t |        421    1.696912    1.446166       -.68        7.6
positive_e~n |        421     3.02133    1.908511        .64       9.62
-------------+---------------------------------------------------------
negative_e~n |        421    1.324418    .7893864          0       5.22
   incumbent |        421    .2541568    .4359042          0          1
          pm |        421    .1543943    .3617562          0          1
          fm |        421    .1496437    .3571463          0          1
  left_right |        382     4.98458    2.366081         .5   9.824561
-------------+---------------------------------------------------------
   inflation |        400    4.367223    4.699949    -.83553   25.10564
 inflation_l |        400    4.911179    5.451015  -.9461664   28.78333
unemployment |        421    8.899962    4.497289      3.359      22.64
unemployme~l |        414    8.747821    4.522593      3.137       22.9
rgdpe_growth |        421    2.852763    3.571232  -4.305958   12.30451
-------------+---------------------------------------------------------
lrgdpe_gro~h |        421    2.716662    3.391096  -6.225039   10.43808
rgdpo_growth |        421    2.955977    3.621164  -6.712398   12.85193
lrgdpo_gro~h |        421    2.572339    3.704223  -7.322986   10.34733
    party_id |        421    797.2565    465.0217         11       1647
  party_name |          0
-------------+---------------------------------------------------------
incumben~n_l |        400    1.359408    3.844508  -.9461664   28.78333
incumben~t_l |        414    2.160932    4.305807          0       22.9
inc~e_growth |        421    .6976881     2.05097  -6.225039   10.43808
inc~o_growth |        421    .6570862    2.107362  -7.322986   10.34733
incumbent_pm |        421    .1543943    .3617562          0          1
-------------+---------------------------------------------------------
incumbent_fm |        421    .1377672    .3450656          0          1
 left_right2 |        382    30.42972    24.22462        .25     96.522
   extremist |        412     .211165    .4086314          0          1
  extremist2 |        412    .3009709    .4592377          0          1
       MG_b1 |    100,000    .2551816    .0776067  -.0968878   .6200964
-------------+---------------------------------------------------------
       MG_b2 |    100,000    .2434079    .0772737  -.0982193   .5716601
       MG_b3 |    100,000   -.5048136    .1046974  -.9708226  -.0542372
       MG_b4 |    100,000    1.720395    .1635842   1.043124   2.387211
      _merge |    100,000           3           0          3          3

. gen extremist_nonPM = (MG_b4+MG_b3+MG_b1)/(MG_b4+MG_b1);

. sum extremist_nonPM;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
extremist_~M |    100,000    .7443975    .0490558   .5294554   .9745589

. centile extremist_nonPM, centile(2.5 97.5);

                                                       -- Binom. Interp. --
    Variable |       Obs  Percentile    Centile        [95% Conf. Interval]
-------------+-------------------------------------------------------------
extremist_~M |   100,000        2.5    .6474621        .6465931    .6482503
             |                 97.5    .8407087         .839851     .841399

. drop MG_b1-MG_b4 extremist_nonPM _merge;

. *     ****************************************************************  *;
. *       extremist non-PM incumbent vs moderate non-PM incumbent         *;
. *     ****************************************************************  *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent incumbent_pm extremist, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       412
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.1834                         Obs per group: min =        35
       between = 0.1569                                        avg =      58.9
       overall = 0.0325                                        max =       100

                                                Wald chi2(3)       =     71.65
corr(u_i, Xb)  = -0.0408                        Prob > chi2        =    0.0000

                            (Replications based on 70 clusters in election_id)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
positive_s~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   incumbent |   .2555482   .0776734     3.29   0.001     .1033112    .4077852
incumbent_pm |   .2428077   .0770869     3.15   0.002     .0917202    .3938951
   extremist |  -.5040679   .1044126    -4.83   0.000    -.7087128    -.299423
       _cons |   1.719485   .1639879    10.49   0.000     1.398074    2.040895
-------------+----------------------------------------------------------------
     sigma_u |  1.3615153
     sigma_e |  .66276504
         rho |   .8084339   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. preserve;

. set obs 100000;
number of observations (_N) was 100,000, now 100,000

. set seed 10101;

. drawnorm MG_b1-MG_b4, n(100000) means(e(b)) cov(e(V)) clear;
(obs 100,000)

. save simulated_betas, replace;
file simulated_betas.dta saved

. restore;

. merge using simulated_betas;
(note: you are using old merge syntax; see [D] merge for new syntax)

. summarize;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
         cow |        421    234.2874    38.36343        200        325
     country |          0
        year |        421    1996.347    9.457847       1980       2012
 election_id |        421    33.21615    21.18554          1         70
party_name~h |          0
-------------+---------------------------------------------------------
 family_name |          0
   family_id |        412    14.24515    9.051924          3         40
    language |        421    3.491686    2.110755          1          7
positive_s~t |        421    1.696912    1.446166       -.68        7.6
positive_e~n |        421     3.02133    1.908511        .64       9.62
-------------+---------------------------------------------------------
negative_e~n |        421    1.324418    .7893864          0       5.22
   incumbent |        421    .2541568    .4359042          0          1
          pm |        421    .1543943    .3617562          0          1
          fm |        421    .1496437    .3571463          0          1
  left_right |        382     4.98458    2.366081         .5   9.824561
-------------+---------------------------------------------------------
   inflation |        400    4.367223    4.699949    -.83553   25.10564
 inflation_l |        400    4.911179    5.451015  -.9461664   28.78333
unemployment |        421    8.899962    4.497289      3.359      22.64
unemployme~l |        414    8.747821    4.522593      3.137       22.9
rgdpe_growth |        421    2.852763    3.571232  -4.305958   12.30451
-------------+---------------------------------------------------------
lrgdpe_gro~h |        421    2.716662    3.391096  -6.225039   10.43808
rgdpo_growth |        421    2.955977    3.621164  -6.712398   12.85193
lrgdpo_gro~h |        421    2.572339    3.704223  -7.322986   10.34733
    party_id |        421    797.2565    465.0217         11       1647
  party_name |          0
-------------+---------------------------------------------------------
incumben~n_l |        400    1.359408    3.844508  -.9461664   28.78333
incumben~t_l |        414    2.160932    4.305807          0       22.9
inc~e_growth |        421    .6976881     2.05097  -6.225039   10.43808
inc~o_growth |        421    .6570862    2.107362  -7.322986   10.34733
incumbent_pm |        421    .1543943    .3617562          0          1
-------------+---------------------------------------------------------
incumbent_fm |        421    .1377672    .3450656          0          1
 left_right2 |        382    30.42972    24.22462        .25     96.522
   extremist |        412     .211165    .4086314          0          1
  extremist2 |        412    .3009709    .4592377          0          1
       MG_b1 |    100,000    .2551816    .0776067  -.0968878   .6200964
-------------+---------------------------------------------------------
       MG_b2 |    100,000    .2434079    .0772737  -.0982193   .5716601
       MG_b3 |    100,000   -.5048136    .1046974  -.9708226  -.0542372
       MG_b4 |    100,000    1.720395    .1635842   1.043124   2.387211
      _merge |    100,000           3           0          3          3

. gen extremist_PM = (MG_b4+MG_b3+MG_b1+MG_b2)/(MG_b4+MG_b1+MG_b2);

. sum extremist_PM;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
extremist_PM |    100,000    .7723509    .0444334   .5764542   .9770275

. centile extremist_PM, centile(2.5 97.5);

                                                       -- Binom. Interp. --
    Variable |       Obs  Percentile    Centile        [95% Conf. Interval]
-------------+-------------------------------------------------------------
extremist_PM |   100,000        2.5    .6846098          .68383    .6856049
             |                 97.5    .8592913        .8584706    .8600376

. drop MG_b1-MG_b4 extremist_PM _merge;

. *     ****************************************************************  *;
. *       Let's find out the number of times that a party has been an     *;
. *       incumbent or an incumbent PM.                                   *;
. *     ****************************************************************  *;
. sort party_id;

. by party_id: egen sum_incumbent=sum(incumbent);

. by party_id: egen sum_incumbent_pm=sum(incumbent_pm);

. drop if party_id==.;
(99,579 observations deleted)

. *     ****************************************************************  *;
. *       To help collect summary information about the parties, we'll    *;
. *       collapse the data on party_id.                                  *;
. *     ****************************************************************  *;
. collapse incumbent sum_incumbent incumbent_pm sum_incumbent_pm, by(party_id);

. *     ****************************************************************  *;
. *       We have manifestos from 108 distinct parties.                   *;
. *     ****************************************************************  *;
. sum;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
    party_id |        108    840.3796    510.0616         11       1647
   incumbent |        108    .1652848    .2696308          0          1
sum_incumb~t |        108    .9907407    1.916458          0          9
incumbent_pm |        108    .0937243    .2216473          0          1
sum_incumb~m |        108    .6018519     1.53428          0          8

. *     ****************************************************************  *;
. *       74 parties have never been in government. 2 have always been    *;
. *       in office. This means that only 32 parties provide variation on *;
. *       incumbency status. Of these, only 22 have been incumbents more  *;
. *       than once.                                                      *;
. *     ****************************************************************  *;
. tab sum_incumbent;

     (mean) |
sum_incumbe |
         nt |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         74       68.52       68.52
          1 |         10        9.26       77.78
          2 |          6        5.56       83.33
          3 |          6        5.56       88.89
          4 |          5        4.63       93.52
          5 |          1        0.93       94.44
          6 |          4        3.70       98.15
          9 |          2        1.85      100.00
------------+-----------------------------------
      Total |        108      100.00

. tab incumbent;

     (mean) |
  incumbent |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         74       68.52       68.52
         .2 |          1        0.93       69.44
   .2222222 |          1        0.93       70.37
        .25 |          2        1.85       72.22
   .2727273 |          1        0.93       73.15
         .3 |          1        0.93       74.07
   .3333333 |          1        0.93       75.00
       .375 |          2        1.85       76.85
         .4 |          1        0.93       77.78
   .4285714 |          1        0.93       78.70
   .4444444 |          1        0.93       79.63
         .5 |          9        8.33       87.96
   .5714286 |          1        0.93       88.89
       .625 |          1        0.93       89.81
   .6666667 |          7        6.48       96.30
   .8181818 |          2        1.85       98.15
          1 |          2        1.85      100.00
------------+-----------------------------------
      Total |        108      100.00

. *     ****************************************************************  *;
. *       88 parties have never been PM parties and 2 parties have always *;
. *       been pm. This means that only 18 parties provide variation on   *;
. *       being an incumbent PM. Of these, only 12 were incumbent PMs     *;
. *       more than once.                                                 *;
. *     ****************************************************************  *;
. tab sum_incumbent_pm;

     (mean) |
sum_incumbe |
      nt_pm |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         88       81.48       81.48
          1 |          6        5.56       87.04
          2 |          2        1.85       88.89
          3 |          3        2.78       91.67
          4 |          4        3.70       95.37
          5 |          2        1.85       97.22
          6 |          2        1.85       99.07
          8 |          1        0.93      100.00
------------+-----------------------------------
      Total |        108      100.00

. tab incumbent_pm;

     (mean) |
incumbent_p |
          m |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |         88       81.48       81.48
   .0909091 |          1        0.93       82.41
   .1818182 |          1        0.93       83.33
        .25 |          2        1.85       85.19
   .3333333 |          1        0.93       86.11
       .375 |          1        0.93       87.04
         .4 |          1        0.93       87.96
   .4285714 |          1        0.93       88.89
         .5 |          4        3.70       92.59
   .5555556 |          1        0.93       93.52
   .5714286 |          1        0.93       94.44
       .625 |          1        0.93       95.37
   .6666667 |          2        1.85       97.22
   .7272727 |          1        0.93       98.15
          1 |          2        1.85      100.00
------------+-----------------------------------
      Total |        108      100.00

. *     ****************************************************************  *;
. *       Let's look at incumbency and party fixed effects.               *;
. *     ****************************************************************  *;
. clear;

. use "C:\Users\mgolder\Dropbox\campaign_sentiment_paper\replication\data_analysis\sentiment.dta", clear;

. *     ****************************************************************  *;
. *       Declare data to be panel, where the panel is based on party     *;
. *     ****************************************************************  *;
. xtset party_id;
       panel variable:  party_id (unbalanced)

. *     ****************************************************************  *;
. *       Estimate the models.                                            *;
. *     ****************************************************************  *;
. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       421
Group variable: party_id                        Number of groups   =       108

R-sq:  within  = 0.0278                         Obs per group: min =         1
       between = 0.0234                                        avg =       3.9
       overall = 0.0266                                        max =        11

                                                Wald chi2(1)       =      8.38
corr(u_i, Xb)  = 0.0948                         Prob > chi2        =    0.0038

                            (Replications based on 70 clusters in election_id)
------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
positive_s~t |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
   incumbent |   .2472332   .0854143     2.89   0.004     .0798243    .4146421
       _cons |   1.634076    .148705    10.99   0.000      1.34262    1.925533
-------------+----------------------------------------------------------------
     sigma_u |  1.3746287
     sigma_e |  .54906981
         rho |  .86240693   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. preserve;

. set obs 10000;
number of observations (_N) was 421, now 10,000

. set seed 10101;

. drawnorm MG_b1-MG_b2, n(100000) means(e(b)) cov(e(V)) clear;
(obs 100,000)

. save simulated_betas, replace;
file simulated_betas.dta saved

. restore;

. merge using simulated_betas;
(note: you are using old merge syntax; see [D] merge for new syntax)

. summarize;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
         cow |        421    234.2874    38.36343        200        325
     country |          0
        year |        421    1996.347    9.457847       1980       2012
 election_id |        421    33.21615    21.18554          1         70
party_name~h |          0
-------------+---------------------------------------------------------
 family_name |          0
   family_id |        412    14.24515    9.051924          3         40
    language |        421    3.491686    2.110755          1          7
positive_s~t |        421    1.696912    1.446166       -.68        7.6
positive_e~n |        421     3.02133    1.908511        .64       9.62
-------------+---------------------------------------------------------
negative_e~n |        421    1.324418    .7893864          0       5.22
   incumbent |        421    .2541568    .4359042          0          1
          pm |        421    .1543943    .3617562          0          1
          fm |        421    .1496437    .3571463          0          1
  left_right |        382     4.98458    2.366081         .5   9.824561
-------------+---------------------------------------------------------
   inflation |        400    4.367223    4.699949    -.83553   25.10564
 inflation_l |        400    4.911179    5.451015  -.9461664   28.78333
unemployment |        421    8.899962    4.497289      3.359      22.64
unemployme~l |        414    8.747821    4.522593      3.137       22.9
rgdpe_growth |        421    2.852763    3.571232  -4.305958   12.30451
-------------+---------------------------------------------------------
lrgdpe_gro~h |        421    2.716662    3.391096  -6.225039   10.43808
rgdpo_growth |        421    2.955977    3.621164  -6.712398   12.85193
lrgdpo_gro~h |        421    2.572339    3.704223  -7.322986   10.34733
    party_id |        421    797.2565    465.0217         11       1647
  party_name |          0
-------------+---------------------------------------------------------
       MG_b1 |    100,000      .24683    .0853409  -.1403263    .648112
       MG_b2 |    100,000    1.634857    .1493497   .9682479   2.253201
      _merge |    100,000     2.00421    .0647481          2          3

. gen incumbent1 = (MG_b2+MG_b1)/(MG_b2);

. sum incumbent1;

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
  incumbent1 |    100,000    1.151313    .0519913   .8941289   1.425421

. centile incumbent1, centile(2.5 97.5);

                                                       -- Binom. Interp. --
    Variable |       Obs  Percentile    Centile        [95% Conf. Interval]
-------------+-------------------------------------------------------------
  incumbent1 |   100,000        2.5     1.04916        1.048298    1.050048
             |                 97.5    1.254531        1.253646    1.255546

. drop MG_b1-MG_b2 incumbent1 _merge;

. *     ****************************************************************  *;
. *       Declare data to be panel, where the panel is based on language  *;
. *     ****************************************************************  *;
. xtset language;
       panel variable:  language (unbalanced)

. *     ****************************************************************  *;
. *       Is the effect of incumbency stronger for single-party           *;
. *       governments?                                                    *;
. *     ****************************************************************  *;
. sort election_id;

. by election_id: egen incumbent_number = sum(incumbent);

. gen coalition=0;

. replace coalition=1 if incumbent_number>1;
(222 real changes made)

. tab coalition;

  coalition |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |     99,778       99.78       99.78
          1 |        222        0.22      100.00
------------+-----------------------------------
      Total |    100,000      100.00

.  gen incumbent_coalition = incumbent*coalition;
(99,579 missing values generated)

. tab incumbent_coalition;

incumbent_c |
   oalition |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |        346       82.19       82.19
          1 |         75       17.81      100.00
------------+-----------------------------------
      Total |        421      100.00

. bootstrap, reps(400) seed(10101) cluster(election_id): xtreg positive_sentiment incumbent coalition incumbent_coalition, fe;
(running xtreg on estimation sample)

Bootstrap replications (400)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 
..................................................    50
..................................................   100
..................................................   150
..................................................   200
..................................................   250
..................................................   300
..................................................   350
..................................................   400

Fixed-effects (within) regression               Number of obs      =       421
Group variable: language                        Number of groups   =         7

R-sq:  within  = 0.1233                         Obs per group: min =        36
       between = 0.1714                                        avg =      60.1
       overall = 0.1042                                        max =       102

                                                Wald chi2(3)       =     68.30
corr(u_i, Xb)  = 0.1649                         Prob > chi2        =    0.0000

                                   (Replications based on 70 clusters in election_id)
-------------------------------------------------------------------------------------
                    |   Observed   Bootstrap                         Normal-based
 positive_sentiment |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------------+----------------------------------------------------------------
          incumbent |   .6209144   .1086407     5.72   0.000     .4079826    .8338462
          coalition |  -.2879841   .1287508    -2.24   0.025     -.540331   -.0356372
incumbent_coalition |  -.0606292   .1451778    -0.42   0.676    -.3451724    .2239141
              _cons |   1.701762   .1665784    10.22   0.000     1.375274     2.02825
--------------------+----------------------------------------------------------------
            sigma_u |  1.3134872
            sigma_e |  .68132089
                rho |  .78798382   (fraction of variance due to u_i)
-------------------------------------------------------------------------------------

. *     ****************************************************************  *;
. *       Replication complete                                            *;
. *     ****************************************************************  *;
. log close;
      name:  <unnamed>
       log:  C:\Users\mgolder\Dropbox\campaign_sentiment_paper\replication\data_analysis\sentiment.log
  log type:  text
 closed on:  14 Jan 2019, 12:02:15
------------------------------------------------------------------------------------------------------------------------------------------------
